home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-03-06 | 46.4 KB | 2,092 lines |
- *** 1.66 1992/02/04 17:11:06
- --- Changelo 1992/03/06 19:25:58
- ***************
- *** 2784,2786 ****
- --- 2784,2856 ----
- sfp004 code and software floating point code merged into one file.
-
- ---------------------------- Patchlevel 75 ---------------------------
- +
- + getopt.c, random.c, ctime.c:: michal
- + get rid of dependency on doprnt().
- +
- + random.c:: ++jrb
- + warn about needing an ANSI pre-processor for str concat.
- +
- + bcopy.s, memcpy.c:: ++jrb
- + DELETE these files.
- +
- + bcopy.s, memcpy.s:: michal
- + replace with these. note now memcpy and memmove are NOT
- + equivalenced. memmove will correctly handle overlap, while memcpy
- + will not.
- +
- + bcopy.s, memcpy.s:: ++jrb
- + make the cnt check unsigned.
- +
- + string.h:: ++jrb
- + adjust protos for bXXXX() functions to size_t for counts.
- +
- + mincl:: ++jrb
- + adjust dependcy for memcpy()
- +
- + memcpy.s:: ++jrb
- + was missing label setup:
- +
- + osbind.h:: michal
- + Add new Waketime() binding for ST Book.
- +
- + osbind.h:: Warwick@cs.uq.oz.au
- + change cast for Kbdvbase() as g++ wont grok void (**)
- +
- + ctype.[ch]:: ers/++jrb
- + change _ctype[] back to pointer so that locales may switch pointers.
- + keep andreas's changes for unsigned index into ctype in. that
- + way EOF is covered too. (by the 0xff entry).
- +
- + compiler.h file.h unistd.h assert.h ostruct.h:: ++jrb
- + sync up with mntlib pl18 changes for soz etc.
- +
- + bcmp.c, bzero.c, qsort.c: ers
- + Ansification (casting lvalues is a no-no :-).
- +
- + doprnt.c getcwd.c memccpy.c mkdir.c tmpnam.c fdopen.c
- + getenv.c memchr.c sbrk.c ftw.c memcmp.c sleep.c crt0.c
- + getbuf.c malloc.c memset.c sprintf.c strdup.c system.c sysvar.c:: ++jrb
- + merge in soz portability changes as per mntlib 18
- +
- + mkdir.c:: ++jrb
- + check for existance before attempting to make per mntlib 18
- +
- + doprnt.c:: ++jrb
- + t was not being initialized in one case. do it at the top.
- +
- + gnulib2.c:: ++jrb
- + add support routines for gcc-2.0: note that the lib needs
- + to be re-compiled BEFORE you try to compile gcc-2.0,
- + otherwise you will end up chasing your tail!
- +
- + ldexp.cpp: mjr++
- + rewrote the sfp code.
- +
- + doprnt.c: mjr++
- + fixed my bug in the treatment of NaNs and Infinities.
- +
- + mktemp.c:: ++jrb
- + make mktemp() more MiNT friendly by using pid when __mint.
- +
- + ---------------------------- Patchlevel 76 ---------------------------
- *** 1.8 1992/02/04 17:11:06
- --- DMakefile 1992/03/06 19:25:58
- ***************
- *** 61,67 ****
- difftime.c fungetc.c memccpy.c screen.c strncat.c vfork.c \
- dirent.c fwrite.c memchr.c setbuf.c strncmp.c write.c \
- div.c getbuf.c memcmp.c setlocal.c strncpy.c \
- ! doprnt.c getcwd.c memcpy.c setvbuf.c strpbrk.c \
- dup.c getenv.c memset.c sgtty.c strrchr.c device.c \
- pipe.c binmode.c timeoday.c
-
- --- 61,67 ----
- difftime.c fungetc.c memccpy.c screen.c strncat.c vfork.c \
- dirent.c fwrite.c memchr.c setbuf.c strncmp.c write.c \
- div.c getbuf.c memcmp.c setlocal.c strncpy.c \
- ! doprnt.c getcwd.c setvbuf.c strpbrk.c \
- dup.c getenv.c memset.c sgtty.c strrchr.c device.c \
- pipe.c binmode.c timeoday.c
-
- *** 1.51 1992/01/29 20:58:29
- --- PatchLev.h 1992/03/06 19:25:59
- ***************
- *** 1,5 ****
-
- ! #define PatchLevel "75"
-
- /*
- *
- --- 1,5 ----
-
- ! #define PatchLevel "76"
-
- /*
- *
- *** 1.9 1991/06/23 17:07:09
- --- bcmp.c 1992/03/06 19:26:09
- ***************
- *** 4,9 ****
- --- 4,10 ----
-
- #undef ODD
- #define ODD(x) (((short)(x)) & 1) /* word ops are faster */
- + #define INC(x, size) x = (const void *)(((const char *)(x)) + (size))
-
- /*
- * compare n bytes efficientlty
- ***************
- *** 13,21 ****
- * ++jrb bammi@dsrgsun.ces.cwru.edu
- */
- asm(".stabs \"_lbcmp\",5,0,0,_bcmp"); /* dept of clean tricks */
- int bcmp(src, dst, n)
- ! const register void * src;
- ! const register void * dst;
- register size_t n;
- {
- assert ((src != NULL) && (dst != NULL));
- --- 14,23 ----
- * ++jrb bammi@dsrgsun.ces.cwru.edu
- */
- asm(".stabs \"_lbcmp\",5,0,0,_bcmp"); /* dept of clean tricks */
- +
- int bcmp(src, dst, n)
- ! const void * src;
- ! const void * dst;
- register size_t n;
- {
- assert ((src != NULL) && (dst != NULL));
- ***************
- *** 27,34 ****
- switch(ODD(src) + ODD(dst))
- {
- case 2: /* ODD ODD */
- ! if(*(char *)dst++ != *(char *)src++)
- return 1;
- n--;
- /* fall thru */
-
- --- 29,38 ----
- switch(ODD(src) + ODD(dst))
- {
- case 2: /* ODD ODD */
- ! if (*(const char *)dst != *(const char *)src)
- return 1;
- + INC(src, 1);
- + INC(dst, 1);
- n--;
- /* fall thru */
-
- ***************
- *** 37,53 ****
- n -= (l << 2);
- w = (n >> 1); /* # of words */
- n -= (w << 1); /* n == # of residual bytes */
- ! while(l--)
- ! if( *((long *)dst)++ != *((long *)src)++ )
- ! return 1;
- ! while(w--)
- ! if( *((short *)dst)++ != *((short *)src)++ )
- return 1;
- /* fall thru */
- case 1: /* ODD/EVEN or EVEN/ODD */
- ! while(n--)
- ! if( *(char *)dst++ != *(char *)src++ )
- return 1;
- }
- }
- return 0;
- --- 41,66 ----
- n -= (l << 2);
- w = (n >> 1); /* # of words */
- n -= (w << 1); /* n == # of residual bytes */
- ! while(l--) {
- ! if (*((const long *)dst) != *((const long *)src))
- ! return 1;
- ! INC(dst, sizeof(long));
- ! INC(src, sizeof(long));
- ! }
- ! while(w--) {
- ! if( *((const short *)dst) != *((const short *)src) )
- return 1;
- + INC(dst, sizeof(short));
- + INC(src, sizeof(short));
- + }
- /* fall thru */
- case 1: /* ODD/EVEN or EVEN/ODD */
- ! while(n--) {
- ! if( *(const char *)dst != *(const char *)src )
- return 1;
- + INC(dst, 1);
- + INC(src, 1);
- + }
- }
- }
- return 0;
- *** 1.9 1991/06/23 17:07:09
- --- bzero.c 1992/03/06 19:26:11
- ***************
- *** 4,9 ****
- --- 4,10 ----
-
- #undef ODD
- #define ODD(x) (((short)(x)) & 1) /* word ops are faster */
- + #define INC(b, size) b = (void *)( ((char *)(b)) + (size) )
-
- /*
- * zero out a chunk efficiently
- ***************
- *** 12,20 ****
- * ++jrb bammi@dsrgsun.ces.cwru.edu
- */
- asm(".stabs \"_lbzero\",5,0,0,_bzero"); /* dept of clean tricks */
- void bzero(b, n)
- ! register void * b;
- ! register size_t n;
- {
- register size_t l, w;
-
- --- 13,22 ----
- * ++jrb bammi@dsrgsun.ces.cwru.edu
- */
- asm(".stabs \"_lbzero\",5,0,0,_bzero"); /* dept of clean tricks */
- +
- void bzero(b, n)
- ! void * b;
- ! size_t n;
- {
- register size_t l, w;
-
- ***************
- *** 22,28 ****
-
- if(ODD(b))
- {
- ! *(char *)b++ = (char)0;
- n--;
- }
-
- --- 24,31 ----
-
- if(ODD(b))
- {
- ! *(char *)b = (char)0;
- ! INC(b, 1);
- n--;
- }
-
- ***************
- *** 31,41 ****
- w = (n >> 1); /* # of words */
- n -= (w << 1); /* n == # of residual bytes */
-
- ! while(l--)
- ! *((long *)b)++ = 0L;
- ! while(w--)
- ! *((short *)b)++ = (short)0;
- ! while(n--)
- ! *(char *)b++ = (char)0;
- }
-
- --- 34,50 ----
- w = (n >> 1); /* # of words */
- n -= (w << 1); /* n == # of residual bytes */
-
- ! while(l--) {
- ! *((long *)b) = 0L;
- ! INC(b, sizeof(long));
- ! }
- ! while(w--) {
- ! *((short *)b) = (short)0;
- ! INC(b, sizeof(short));
- ! }
- ! while(n--) {
- ! *(char *)b = (char)0;
- ! INC(b, 1);
- ! }
- }
-
- *** 1.19 1992/02/04 17:11:06
- --- crt0.c 1992/03/06 19:26:13
- ***************
- *** 80,85 ****
- --- 80,86 ----
- #ifndef _COMPILER_H
- #include <compiler.h>
- #endif
- + #include <stddef.h>
-
- #define isspace(c) ((c) == ' '||(c) == '\t')
- #define BUFSIZ ((unsigned long)1024) /* this must track the value */
- ***************
- *** 112,118 ****
- void *_heapbase;
-
- /* default sizeof stdio buffers */
- ! unsigned long __DEFAULT_BUFSIZ__; /* .comm */
-
- /* are we an app? */
- short _app;
- --- 113,119 ----
- void *_heapbase;
-
- /* default sizeof stdio buffers */
- ! size_t __DEFAULT_BUFSIZ__; /* .comm */
-
- /* are we an app? */
- short _app;
- *** 1.6 1991/04/26 03:42:08
- --- ctime.c 1992/03/06 19:26:13
- ***************
- *** 13,18 ****
- --- 13,54 ----
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
-
-
- + #ifdef __GNUC__
- + /*
- + * macro to produce two decimal digits of mval and write them
- + * at position pointed by mptr - moves mptr to the next free position;
- + * mval has to be in range 0-99, or banshee will get you
- + */
- + #define _TWODIG(mptr,mval) \
- + { \
- + long _i = (long)(mval); \
- + __asm__ volatile("
- + extl %1;
- + divu #10,%1;
- + addb #48,%1;
- + moveb %1,%0@+;
- + swap %1;
- + addb #48,%1;
- + moveb %1,%0@+" \
- + : "=a"((long)mptr) \
- + : "d"(_i), "g"((unsigned short)mval), \
- + "0"(mptr)); \
- + }
- +
- + #else
- +
- + static char *
- + two_dig(char *buf, unsigned short num) {
- + unsigned int rem;
- +
- + rem = num % 10;
- + *buf++ = '0' + (num / 10);
- + *buf++ = '0' + rem;
- + return buf;
- + }
- +
- + #endif /* __GNUC__ */
- +
- char *asctime(time)
- register const struct tm *time;
- /*
- ***************
- *** 20,34 ****
- * the same internal buffer, as for ctime() is used for this function.
- */
- {
- ! if (time == NULL)
- ! (void)strcpy(timebuf, "??? ??? ?? ??:??:?? ????\n");
- ! else
- ! (void)sprintf(timebuf, "%.3s %.3s%3d %02d:%02d:%02d %04d\n",
- ! day[time->tm_wday], month[time->tm_mon], time->tm_mday,
- ! time->tm_hour, time->tm_min, time->tm_sec, 1900+time->tm_year);
- ! return(timebuf);
- }
-
- char *ctime(rawtime)
- const time_t *rawtime;
- /*
- --- 56,103 ----
- * the same internal buffer, as for ctime() is used for this function.
- */
- {
- ! unsigned short values[6], *vpos, *valp;
- ! int i;
- ! char * ptr = timebuf;
- !
- ! (void)strcpy(ptr, "??? ??? ?? ??:??:?? ????\n");
- ! if (time != NULL)
- ! {
- ! vpos = values;
- ! *vpos++ = time->tm_mday;
- ! *vpos++ = time->tm_hour;
- ! *vpos++ = time->tm_min;
- ! *vpos++ = time->tm_sec;
- ! i = 1900 + time->tm_year;
- ! *vpos++ = i / 100;
- ! *vpos = i % 100;
- ! ptr = memcpy(ptr, day[time->tm_wday], 3) + 3;
- ! ptr += 1;
- ! ptr = memcpy(ptr, month[time->tm_mon], 3) + 3;
- ! valp = values;
- ! do
- ! {
- ! ptr += 1;
- ! #ifdef __GNUC__
- ! _TWODIG(ptr, *valp++);
- ! #else
- ! ptr = two_dig(ptr, *valp++);
- ! #endif /* __GNUC__ */
- ! }
- ! while (valp < vpos);
- ! #ifdef __GNUC__
- ! _TWODIG(ptr, *valp);
- ! #else
- ! ptr = two_dig(ptr, *valp);
- ! #endif /* __GNUC__ */
- ! if ('0' == timebuf[8])
- ! timebuf[8] = ' '; /* blank out leading zero on a day */
- !
- ! }
- ! return(timebuf);
- }
-
- +
- char *ctime(rawtime)
- const time_t *rawtime;
- /*
- ***************
- *** 35,41 ****
- * Convert <rawtime> to a string. A 26 character fixed field string
- * is created from the raw time value. The following is an example
- * of what this string might look like:
- ! * "Wed Jul 08 18:43:07 1987\n\0"
- * A 24-hour clock is used, and due to a limitation in the ST system
- * clock value, only a resolution of 2 seconds is possible. A pointer
- * to the formatted string, which is held in an internal buffer, is
- --- 104,110 ----
- * Convert <rawtime> to a string. A 26 character fixed field string
- * is created from the raw time value. The following is an example
- * of what this string might look like:
- ! * "Wed Jul 8 18:43:07 1987\n\0"
- * A 24-hour clock is used, and due to a limitation in the ST system
- * clock value, only a resolution of 2 seconds is possible. A pointer
- * to the formatted string, which is held in an internal buffer, is
- *** 1.6 1992/01/29 20:58:29
- --- ctype.c 1992/03/06 19:26:13
- ***************
- *** 12,18 ****
- /* some code uses these as function pointers -- i */
- /* have seen code that does. */
-
- ! unsigned char _ctype[UCHAR_MAX+1] =
- {
- _CTc, _CTc, _CTc, _CTc, /* 0x00..0x03 */
- _CTc, _CTc, _CTc, _CTc, /* 0x04..0x07 */
- --- 12,18 ----
- /* some code uses these as function pointers -- i */
- /* have seen code that does. */
-
- ! static unsigned char _myctype[UCHAR_MAX+1] =
- {
- _CTc, _CTc, _CTc, _CTc, /* 0x00..0x03 */
- _CTc, _CTc, _CTc, _CTc, /* 0x04..0x07 */
- ***************
- *** 63,68 ****
- --- 63,70 ----
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xE0..0xEF */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* 0xF0..0xFF */
- };
- +
- + unsigned char *_ctype = &(_myctype[0]);
-
- int toupper(c)
- int c;
- *** 1.9 1992/02/04 17:11:06
- --- doprnt.c 1992/03/06 19:26:15
- ***************
- *** 22,27 ****
- --- 22,28 ----
- * mjr++
- */
-
- + #ifndef __NO_FLOAT__
- static unsigned long
- __notanumber[2] = { 0x7fffffffL, 0xffffffffL }; /* ieee NAN */
- #define NAN (*((double *)&__notanumber[0]))
- ***************
- *** 28,33 ****
- --- 29,35 ----
- static unsigned long
- __p_infinity[2] = { 0x7ff00000L, 0x00000000L }; /* ieee NAN */
- #define INF (*((double *)&__p_infinity[0]))
- + #endif
-
- #ifdef LIBC_SCCS
- static char sccsid[] = "@(#)doprnt.c 5.37 (Berkeley) 3/26/89";
- ***************
- *** 168,173 ****
- --- 170,176 ----
- char *digs; /* digits for [diouxX] conversion */
- char buf[BUF]; /* space for %c, %[diouxX], %[eEfgG] */
-
- + t = buf;
- fmt = (const u_char *) fmt0;
- digs = "0123456789abcdef";
- for (cnt = 0;; ++fmt) {
- ***************
- *** 277,282 ****
- --- 280,286 ----
- #define _double _dd.d
- _double = va_arg(argp, double);
- if( (unsigned long)_dd.i[0] == __notanumber[0]) {
- + t = buf;
- t = strcpy(t, " Not A Number ");
- size = strlen(t);
- goto pforw;
- ***************
- *** 308,319 ****
- /* && ((unsigned long)_dd.i[1] == __p_infinity[1]) */
- /* mjr: don't test this in order to catch a conversion bug in gcc-as */
- ) {
- ! if(softsign == 0)
- t = strcpy(t, " Infinity ");
- ! else
- t = strcpy(t, " -Infinity ");
- ! size = strlen(t);
- ! goto pforw;
- }
- /*
- * cvt may have to round up past the "start" of the
- --- 312,324 ----
- /* && ((unsigned long)_dd.i[1] == __p_infinity[1]) */
- /* mjr: don't test this in order to catch a conversion bug in gcc-as */
- ) {
- ! t = buf;
- ! if(softsign == 0)
- t = strcpy(t, " Infinity ");
- ! else
- t = strcpy(t, " -Infinity ");
- ! size = strlen(t);
- ! goto pforw;
- }
- /*
- * cvt may have to round up past the "start" of the
- *** 1.9 1992/01/29 20:58:29
- --- fdopen.c 1992/03/06 19:26:16
- ***************
- *** 12,18 ****
- extern int __default_mode__; /* see binmode.c */
- register int i, iomode = 0, f = __default_mode__;
- register FILE *fp = NULL;
- ! void _getbuf(FILE *);
-
- for(i=0; (!fp && (i < _NFILE)); ++i)
- if(!(_iob[i]._flag & (_IORW | _IOREAD | _IOWRT)))
- --- 12,18 ----
- extern int __default_mode__; /* see binmode.c */
- register int i, iomode = 0, f = __default_mode__;
- register FILE *fp = NULL;
- ! void _getbuf __PROTO((FILE *));
-
- for(i=0; (!fp && (i < _NFILE)); ++i)
- if(!(_iob[i]._flag & (_IORW | _IOREAD | _IOWRT)))
- *** 1.5 1991/04/23 16:04:12
- --- ftw.c 1992/03/06 19:26:22
- ***************
- *** 58,64 ****
-
- /* Get ready to hold the full paths. */
- i = strlen(directory);
- ! fullpath = malloc(i + 1 + MAXNAMLEN + 1);
- if (fullpath == NULL) {
- closedir(dirp);
- return -1;
- --- 58,64 ----
-
- /* Get ready to hold the full paths. */
- i = strlen(directory);
- ! fullpath = malloc((size_t)(i + 1 + MAXNAMLEN + 1));
- if (fullpath == NULL) {
- closedir(dirp);
- return -1;
- *** 1.4 1991/04/12 18:19:53
- --- getbuf.c 1992/03/06 19:26:22
- ***************
- *** 18,24 ****
- fp->_bsiz = __DEFAULT_BUFSIZ__;
-
- if((f & _IONBF) /* risky!! but works ok with gnu.may change */
- ! || ((fp->_base = malloc((size_t)fp->_bsiz)) == NULL) )
- {
- fp->_flag &= ~(_IOFBF | _IOLBF | _IONBF);
- fp->_flag |= _IONBF;
- --- 18,24 ----
- fp->_bsiz = __DEFAULT_BUFSIZ__;
-
- if((f & _IONBF) /* risky!! but works ok with gnu.may change */
- ! || (!(fp->_base = (unsigned char *)malloc((size_t)fp->_bsiz))) )
- {
- fp->_flag &= ~(_IOFBF | _IOLBF | _IONBF);
- fp->_flag |= _IONBF;
- *** 1.9 1991/05/23 14:43:17
- --- getcwd.c 1992/03/06 19:26:23
- ***************
- *** 23,29 ****
- #endif
-
- if (!buf)
- ! if (!(buf = malloc((size_t)size)))
- return NULL;
- path[2] = '\0';
- (void)Dgetpath(path+2, 0);
- --- 23,29 ----
- #endif
-
- if (!buf)
- ! if (!(buf = (char *) malloc((size_t)size)))
- return NULL;
- path[2] = '\0';
- (void)Dgetpath(path+2, 0);
- *** 1.6 1991/04/26 03:42:08
- --- getenv.c 1992/03/06 19:26:23
- ***************
- *** 70,79 ****
- del_env(strng);
-
- if (!environ)
- ! e = malloc(2*sizeof(char *));
- else {
- while(environ[i]) i++ ;
- ! e = malloc((i+2)*sizeof(char *));
- if (!e) {
- return -1;
- }
- --- 70,79 ----
- del_env(strng);
-
- if (!environ)
- ! e = (char **) malloc(2*sizeof(char *));
- else {
- while(environ[i]) i++ ;
- ! e = (char **) malloc((i+2)*sizeof(char *));
- if (!e) {
- return -1;
- }
- *** 1.6 1991/04/26 03:42:08
- --- getopt.c 1992/03/06 19:26:23
- ***************
- *** 20,25 ****
- --- 20,27 ----
- int optind = 1; /* next argv[] index */
- char *optarg = NULL; /* option parameter if any */
-
- + static char mtail[] = " -- x\n";
- +
- static int
- Err( name, mess, c ) /* returns '?' */
- char *name; /* program name argv[0] */
- ***************
- *** 27,37 ****
- int c; /* defective option letter */
- {
- if ( opterr )
- ! (void) fprintf( stderr,
- ! "%s: %s -- %c\n",
- ! name, mess, c
- ! );
- !
- return '?'; /* erroneous-option marker */
- }
-
- --- 29,41 ----
- int c; /* defective option letter */
- {
- if ( opterr )
- ! {
- ! mtail[4] = (char)c;
- ! (void) fputs(name, stderr);
- ! (void) fputs(": ", stderr);
- ! (void) fputs(mess, stderr);
- ! (void) fputs(&mtail[0], stderr);
- ! }
- return '?'; /* erroneous-option marker */
- }
-
- *** 1.7 1991/04/26 03:42:08
- --- gnulib2.c 1992/03/06 19:26:26
- ***************
- *** 29,34 ****
- --- 29,54 ----
- #define L_fixdfdi
- #define L_floatdidf
-
- + /* gcc-2.0 stuff */
- + #define L_lshrsi3
- + #define L_lshlsi3
- + #define L_ashrsi3
- + #define L_ashlsi3
- + #define L_eqdf2
- + #define L_nedf2
- + #define L_gtdf2
- + #define L_gedf2
- + #define L_ltdf2
- + #define L_ledf2
- + #define L_fixsfsi
- + #define L_floatsisf
- + #define L_eqsf2
- + #define L_nesf2
- + #define L_gtsf2
- + #define L_gesf2
- + #define L_ltsf2
- + #define L_lesf2
- +
- #endif /* __DEF_ALL__ */
-
- /* More subroutines needed by GCC output code on some machines. */
- ***************
- *** 1033,1036 ****
- --- 1053,1625 ----
- }
- #endif /* not mips */
- #endif /* not sparc */
- + #endif
- +
- + /* stuff for gcc-2.0, note that you cannot compile the corresponding
- + C code from libgcc1.c for these functions with gcc-2.0!
- + This stuff should eventually be hand optimized as we have done
- + with the other stuff,
- + */
- +
- + #if 0 /* these were the decls used to compile the asm below */
- +
- + #ifndef SItype
- + #define SItype long int
- + #endif
- +
- + #ifndef FLOAT_VALUE_TYPE
- + #define FLOAT_VALUE_TYPE long int
- + #endif
- +
- + #ifndef INTIFY
- + #define INTIFY(FLOATVAL) (intify.f = (FLOATVAL), intify.i)
- + #endif
- +
- + #ifndef FLOATIFY
- + #define FLOATIFY(INTVAL) ((INTVAL).f)
- + #endif
- +
- + #ifndef FLOAT_ARG_TYPE
- + #define FLOAT_ARG_TYPE union flt_or_int
- + #endif
- +
- + union flt_or_value { FLOAT_VALUE_TYPE i; float f; };
- +
- + union flt_or_int { long int i; float f; };
- + #endif
- +
- + #ifdef L_lshrsi3
- + #if 0
- + SItype
- + __lshrsi3 (a, b)
- + unsigned SItype a, b;
- + {
- + return a >> b;
- + }
- + #endif
- +
- + asm(" .text
- + .even
- + .globl ___lshrsi3
- + ___lshrsi3:
- + movel sp@(4),d0
- + movel sp@(8),d1
- + lsrl d1,d0
- + rts
- + ");
- + #endif
- +
- + #ifdef L_lshlsi3
- + #if 0
- + SItype
- + __lshlsi3 (a, b)
- + unsigned SItype a, b;
- + {
- + return a << b;
- + }
- + #endif
- +
- + asm(" .text
- + .even
- + .globl ___lshlsi3
- + ___lshlsi3:
- + movel sp@(4),d0
- + movel sp@(8),d1
- + lsll d1,d0
- + rts
- + ");
- + #endif
- +
- + #ifdef L_ashrsi3
- + #if 0
- + SItype
- + __ashrsi3 (a, b)
- + SItype a, b;
- + {
- + return a >> b;
- + }
- + #endif
- +
- + asm(" .text
- + .even
- + .globl ___ashrsi3
- + ___ashrsi3:
- + movel sp@(4),d0
- + movel sp@(8),d1
- + asrl d1,d0
- + rts
- + ");
- + #endif
- +
- + #ifdef L_ashlsi3
- + #if 0
- + SItype
- + __ashlsi3 (a, b)
- + SItype a, b;
- + {
- + return a << b;
- + }
- + #endif
- +
- + asm(" .text
- + .even
- + .globl ___ashlsi3
- + ___ashlsi3:
- + movel sp@(4),d0
- + movel sp@(8),d1
- + asll d1,d0
- + rts
- + ");
- + #endif
- +
- + #ifdef L_eqdf2
- + #if 0
- + SItype
- + __eqdf2 (a, b)
- + double a, b;
- + {
- + /* Value == 0 iff a == b. */
- + return !(a == b);
- + }
- + #endif
- +
- + asm(" .text
- + .even
- + .globl ___eqdf2
- + ___eqdf2:
- + moveml #0x3000,sp@-
- + movel sp@(12),d1
- + movel sp@(16),d2
- + movel sp@(24),sp@-
- + movel sp@(24),sp@-
- + movel d2,sp@-
- + movel d1,sp@-
- + jbsr ___cmpdf2
- + addw #16,sp
- + tstl d0
- + sne d0
- + moveq #1,d3
- + andl d3,d0
- + moveml sp@+,#0xc
- + rts
- + ");
- + #endif
- +
- + #ifdef L_nedf2
- + #if 0
- + SItype
- + __nedf2 (a, b)
- + double a, b;
- + {
- + /* Value != 0 iff a != b. */
- + return a != b;
- + }
- + #endif
- +
- + asm(" .text
- + .even
- + .globl ___nedf2
- + ___nedf2:
- + moveml #0x3000,sp@-
- + movel sp@(12),d1
- + movel sp@(16),d2
- + movel sp@(24),sp@-
- + movel sp@(24),sp@-
- + movel d2,sp@-
- + movel d1,sp@-
- + jbsr ___cmpdf2
- + addw #16,sp
- + tstl d0
- + sne d0
- + moveq #1,d3
- + andl d3,d0
- + moveml sp@+,#0xc
- + rts
- + ");
- + #endif
- +
- + #ifdef L_gtdf2
- + #if 0
- + SItype
- + __gtdf2 (a, b)
- + double a, b;
- + {
- + /* Value > 0 iff a > b. */
- + return a > b;
- + }
- + #endif
- +
- + asm(" .text
- + .even
- + .globl ___gtdf2
- + ___gtdf2:
- + moveml #0x3000,sp@-
- + movel sp@(12),d1
- + movel sp@(16),d2
- + movel sp@(24),sp@-
- + movel sp@(24),sp@-
- + movel d2,sp@-
- + movel d1,sp@-
- + jbsr ___cmpdf2
- + addw #16,sp
- + tstl d0
- + sgt d0
- + moveq #1,d3
- + andl d3,d0
- + moveml sp@+,#0xc
- + rts
- + ");
- + #endif
- +
- + #ifdef L_gedf2
- + #if 0
- + SItype
- + __gedf2 (a, b)
- + double a, b;
- + {
- + /* Value >= 0 iff a >= b. */
- + return (a >= b) - 1;
- + }
- + #endif
- +
- + asm(" .text
- + .even
- + .globl ___gedf2
- + ___gedf2:
- + moveml #0x3000,sp@-
- + movel sp@(12),d1
- + movel sp@(16),d2
- + movel sp@(24),sp@-
- + movel sp@(24),sp@-
- + movel d2,sp@-
- + movel d1,sp@-
- + jbsr ___cmpdf2
- + addw #16,sp
- + tstl d0
- + sge d0
- + moveq #1,d3
- + andl d3,d0
- + subql #1,d0
- + moveml sp@+,#0xc
- + rts
- + ");
- + #endif
- +
- + #ifdef L_ltdf2
- + #if 0
- + SItype
- + __ltdf2 (a, b)
- + double a, b;
- + {
- + /* Value < 0 iff a < b. */
- + return -(a < b);
- + }
- + #endif
- +
- + asm(" .text
- + .even
- + .globl ___ltdf2
- + ___ltdf2:
- + moveml #0x3000,sp@-
- + movel sp@(12),d1
- + movel sp@(16),d2
- + movel sp@(24),sp@-
- + movel sp@(24),sp@-
- + movel d2,sp@-
- + movel d1,sp@-
- + jbsr ___cmpdf2
- + addw #16,sp
- + tstl d0
- + slt d0
- + moveq #1,d3
- + andl d3,d0
- + negl d0
- + moveml sp@+,#0xc
- + rts
- + ");
- + #endif
- +
- + #ifdef L_ledf2
- + #if 0
- + SItype
- + __ledf2 (a, b)
- + double a, b;
- + {
- + /* Value <= 0 iff a <= b. */
- + return 1 - (a <= b);
- + }
- + #endif
- +
- + asm(" .text
- + .even
- + .globl ___ledf2
- + ___ledf2:
- + movel d2,sp@-
- + movel sp@(8),d0
- + movel sp@(12),d1
- + moveq #1,d2
- + movel sp@(20),sp@-
- + movel sp@(20),sp@-
- + movel d1,sp@-
- + movel d0,sp@-
- + jbsr ___cmpdf2
- + addw #16,sp
- + tstl d0
- + jgt L11
- + moveq #0,d2
- + L11:
- + movel d2,d0
- + movel sp@+,d2
- + rts
- + ");
- + #endif
- +
- + #ifdef L_fixsfsi
- + #if 0
- + SItype
- + __fixsfsi (a)
- + FLOAT_ARG_TYPE a;
- + {
- + union flt_or_value intify;
- + #define perform_fixsfsi(a) return (SItype) a
- + perform_fixsfsi (FLOATIFY (a));
- + }
- + #endif
- +
- + asm(" .text
- + .even
- + .globl ___fixsfsi
- + ___fixsfsi:
- + movel sp@(4),sp@-
- + jbsr ___extendsfdf2
- + addqw #4,sp
- + movel d1,sp@-
- + movel d0,sp@-
- + jbsr ___fixdfsi
- + addqw #8,sp
- + rts
- + ");
- + #endif
- +
- + #ifdef L_floatsisf
- + #if 0
- + FLOAT_VALUE_TYPE
- + __floatsisf (a)
- + SItype a;
- + {
- + union flt_or_value intify;
- + #define perform_floatsisf(a) return INTIFY ((float) a)
- + perform_floatsisf (a);
- + }
- + #endif
- +
- + asm(" .text
- + .even
- + .globl ___floatsisf
- + ___floatsisf:
- + movel sp@(4),sp@-
- + jbsr ___floatsidf
- + addqw #4,sp
- + movel d1,sp@-
- + movel d0,sp@-
- + jbsr ___truncdfsf2
- + addqw #8,sp
- + rts
- + ");
- + #endif
- +
- + #ifdef L_eqsf2
- + #if 0
- + SItype
- + __eqsf2 (a, b)
- + FLOAT_ARG_TYPE a, b;
- + {
- + union flt_or_int intify;
- + /* Value == 0 iff a == b. */
- + #define perform_eqsf2(a, b) return !(a == b)
- + perform_eqsf2 (FLOATIFY (a), FLOATIFY (b));
- + }
- + #endif
- +
- + asm(" .text
- + .even
- + .globl ___eqsf2
- + ___eqsf2:
- + movel d2,sp@-
- + movel sp@(8),d1
- + movel sp@(12),sp@-
- + movel d1,sp@-
- + jbsr ___cmpsf2
- + addqw #8,sp
- + tstl d0
- + sne d0
- + moveq #1,d2
- + andl d2,d0
- + movel sp@+,d2
- + rts
- + ");
- + #endif
- +
- + #ifdef L_nesf2
- + #if 0
- + SItype
- + __nesf2 (a, b)
- + FLOAT_ARG_TYPE a, b;
- + {
- + union flt_or_int intify;
- + /* Value != 0 iff a != b. */
- + #define perform_nesf2(a, b) return a != b
- + perform_nesf2 (FLOATIFY (a), FLOATIFY (b));
- + }
- + #endif
- +
- + asm(" .text
- + .even
- + .globl ___nesf2
- + ___nesf2:
- + movel d2,sp@-
- + movel sp@(8),d1
- + movel sp@(12),sp@-
- + movel d1,sp@-
- + jbsr ___cmpsf2
- + addqw #8,sp
- + tstl d0
- + sne d0
- + moveq #1,d2
- + andl d2,d0
- + movel sp@+,d2
- + rts
- + ");
- + #endif
- +
- + #ifdef L_gtsf2
- + #if 0
- + SItype
- + __gtsf2 (a, b)
- + FLOAT_ARG_TYPE a, b;
- + {
- + union flt_or_int intify;
- + /* Value > 0 iff a > b. */
- + #define perform_gtsf2(a, b) return a > b
- + perform_gtsf2 (FLOATIFY (a), FLOATIFY (b));
- + }
- + #endif
- +
- + asm(" .text
- + .even
- + .globl ___gtsf2
- + ___gtsf2:
- + movel d2,sp@-
- + movel sp@(8),d1
- + movel sp@(12),sp@-
- + movel d1,sp@-
- + jbsr ___cmpsf2
- + addqw #8,sp
- + tstl d0
- + sgt d0
- + moveq #1,d2
- + andl d2,d0
- + movel sp@+,d2
- + rts
- + ");
- + #endif
- +
- + #ifdef L_gesf2
- + #if 0
- + SItype
- + __gesf2 (a, b)
- + FLOAT_ARG_TYPE a, b;
- + {
- + union flt_or_int intify;
- + /* Value >= 0 iff a >= b. */
- + #define perform_gesf2(a, b) return (a >= b) - 1
- + perform_gesf2 (FLOATIFY (a), FLOATIFY (b));
- + }
- + #endif
- +
- + asm(" .text
- + .even
- + .globl ___gesf2
- + ___gesf2:
- + movel d2,sp@-
- + movel sp@(8),d1
- + movel sp@(12),sp@-
- + movel d1,sp@-
- + jbsr ___cmpsf2
- + addqw #8,sp
- + tstl d0
- + sge d0
- + moveq #1,d2
- + andl d2,d0
- + subql #1,d0
- + movel sp@+,d2
- + rts
- + ");
- + #endif
- +
- + #ifdef L_ltsf2
- + #if 0
- + SItype
- + __ltsf2 (a, b)
- + FLOAT_ARG_TYPE a, b;
- + {
- + union flt_or_int intify;
- + /* Value < 0 iff a < b. */
- + #define perform_ltsf2(a, b) return -(a < b)
- + perform_ltsf2 (FLOATIFY (a), FLOATIFY (b));
- + }
- + #endif
- +
- + asm(" .text
- + .even
- + .globl ___ltsf2
- + ___ltsf2:
- + movel d2,sp@-
- + movel sp@(8),d1
- + movel sp@(12),sp@-
- + movel d1,sp@-
- + jbsr ___cmpsf2
- + addqw #8,sp
- + tstl d0
- + slt d0
- + moveq #1,d2
- + andl d2,d0
- + negl d0
- + movel sp@+,d2
- + rts
- + ");
- + #endif
- +
- + #ifdef L_lesf2
- + #if 0
- + SItype
- + __lesf2 (a, b)
- + FLOAT_ARG_TYPE a, b;
- + {
- + union flt_or_int intify;
- + /* Value <= 0 iff a <= b. */
- + #define perform_lesf2(a, b) return 1 - (a <= b); /* note bug fix from libgcc1.c */
- + perform_lesf2 (FLOATIFY (a), FLOATIFY (b));
- + }
- + #endif
- +
- + asm(" .text
- + .even
- + .globl ___lesf2
- + ___lesf2:
- + movel d2,sp@-
- + movel sp@(8),d0
- + moveq #1,d2
- + movel sp@(12),sp@-
- + movel d0,sp@-
- + jbsr ___cmpsf2
- + addqw #8,sp
- + tstl d0
- + jgt L20
- + moveq #0,d2
- + L20:
- + movel d2,d0
- + movel sp@+,d2
- + rts
- + ");
- #endif
- *** 1.4 1992/02/04 17:11:06
- --- ldexp.cpp 1992/03/06 19:26:28
- ***************
- *** 208,231 ****
- #endif ERROR_CHECK
-
- _ldexp:
- ! lea 0xfffa50,a0 | fpu address
- ! movew #0x4011,a0@(comm) | ftwotox to fp0 (as long int!)
- #ifdef __MSHORT__
- ! movew a7@(12),d0 | get exponent
- extl d0
- #else
- ! movel a7@(12),d0 | get exponent
- #endif
- ! cmpiw #0x8900,a0@(resp) | check if fpu is ready
- ! movel d0,a0@ | push arg
- ! .long 0x0c6889000, 0xfff067f8 | wait
- ! movew #0x5423,a0@(comm) | fmul value,fp0
- ! .long 0x0c6889000, 0xfff067f8 | wait
- ! movel a7@(4),a0@ | load value
- ! movel a7@(8),a0@ |
- ! .long 0x0c6889000, 0xfff067f8 | wait
- ! movew #0x7400,a0@(comm) | get double from fp0
- ! .long 0x0c6889000, 0xfff067f8 | wait
- movel a0@,d0
- movel a0@,d1
- #endif sfp004
- --- 208,238 ----
- #endif ERROR_CHECK
-
- _ldexp:
- !
- #ifdef __MSHORT__
- ! movew sp@(12),d0 | get exponent
- extl d0
- #else
- ! movel sp@(12),d0 | get exponent
- #endif
- ! lea 0xfffa50,a0 | fpu address
- ! movew #0x549e,a0@(comm) | fgetexpd sp@(4),fp1
- ! cmpiw #0x8900,a0@(resp)
- ! movel sp@(4),a0@
- ! movel sp@(8),a0@
- ! movew #0x6080,a0@(comm) | fmovel fp1,d1
- ! .long 0x0c688900, 0xfff067f8
- ! movel a0@,d1
- ! addl d0,d1
- ! movew #0x4011,a0@(comm) | ftwotoxl d0,fp0
- ! .long 0x0c688900, 0xfff067f8
- ! movel d0,a0@
- ! movew #0x5423,a0@(comm) | fmuld sp@(4),fp0
- ! .long 0x0c688900, 0xfff067f8
- ! movel sp@(4),a0@
- ! movel sp@(8),a0@
- ! movew #0x7400,a0@(comm) | fmoved fp0,d0/d1
- ! .long 0x0c688900, 0xfff067f8
- movel a0@,d0
- movel a0@,d1
- #endif sfp004
- *** 1.27 1991/06/26 22:31:51
- --- makefile.16 1992/03/06 19:26:30
- ***************
- *** 9,15 ****
- LIB = d:\gnu\lib
-
- # common subset of options; no int size or omit-frame-pointer:
- ! COPTS= -O -fcombine-regs -fstrength-reduce -DNDEBUG $(XFLAGS)
-
- # Base options CC; includes int size but not omit-frame-pointer
- CFFLAGS = $(COPTS) -mshort
- --- 9,15 ----
- LIB = d:\gnu\lib
-
- # common subset of options; no int size or omit-frame-pointer:
- ! COPTS= -O -fstrength-reduce -DNDEBUG $(XFLAGS)
-
- # Base options CC; includes int size but not omit-frame-pointer
- CFFLAGS = $(COPTS) -mshort
- *** 1.26 1991/06/26 22:31:51
- --- makefile.32 1992/03/06 19:26:30
- ***************
- *** 9,15 ****
- LIB = d:\gnu\lib
-
- # common subset of options; no int size or omit-frame-pointer:
- ! COPTS= -O -fcombine-regs -fstrength-reduce -DNDEBUG $(XFLAGS)
-
- # Base options CC; includes int size but not omit-frame-pointer
- CFFLAGS = $(COPTS)
- --- 9,15 ----
- LIB = d:\gnu\lib
-
- # common subset of options; no int size or omit-frame-pointer:
- ! COPTS= -O -fstrength-reduce -DNDEBUG $(XFLAGS)
-
- # Base options CC; includes int size but not omit-frame-pointer
- CFFLAGS = $(COPTS)
- *** 1.19 1992/01/29 20:58:29
- --- malloc.c 1992/03/06 19:26:31
- ***************
- *** 164,171 ****
- if ((!_split_mem) && _heapbase != NULL &&
- s >= (struct mem_chunk *) _heapbase &&
- s < (struct mem_chunk *) (_heapbase + _stksize)) {
- ! assert(s == _heapbase);
- ! _heapbase = (char *) p;
- _stksize += p->size;
- o->next = p->next; /* o is always != NULL here */
- }
- --- 164,171 ----
- if ((!_split_mem) && _heapbase != NULL &&
- s >= (struct mem_chunk *) _heapbase &&
- s < (struct mem_chunk *) (_heapbase + _stksize)) {
- ! assert(s == (struct mem_chunk *) _heapbase);
- ! _heapbase = (void *) p;
- _stksize += p->size;
- o->next = p->next; /* o is always != NULL here */
- }
- ***************
- *** 176,183 ****
- if ((!_split_mem) && _heapbase != NULL &&
- s >= (struct mem_chunk *) _heapbase &&
- s < (struct mem_chunk *) (_heapbase + _stksize)) {
- ! assert(s == _heapbase);
- ! _heapbase = (char *) r;
- _stksize += r->size;
- p->next = r->next;
- } else p->next = r;
- --- 176,183 ----
- if ((!_split_mem) && _heapbase != NULL &&
- s >= (struct mem_chunk *) _heapbase &&
- s < (struct mem_chunk *) (_heapbase + _stksize)) {
- ! assert(s == (struct mem_chunk *) _heapbase);
- ! _heapbase = (void *) r;
- _stksize += r->size;
- p->next = r->next;
- } else p->next = r;
- ***************
- *** 190,196 ****
- void *_r;
- size_t n;
- {
- ! struct mem_chunk *p, *q, *r = _r;
- long sz;
-
- /* obscure features: realloc(NULL,n) is the same as malloc(n)
- --- 190,196 ----
- void *_r;
- size_t n;
- {
- ! struct mem_chunk *p, *q, *r = (struct mem_chunk *) _r;
- long sz;
-
- /* obscure features: realloc(NULL,n) is the same as malloc(n)
- ***************
- *** 256,262 ****
- void * calloc(n, sz)
- size_t n, sz;
- {
- ! char *r;
- size_t total;
-
- total = n * sz;
- --- 256,262 ----
- void * calloc(n, sz)
- size_t n, sz;
- {
- ! void *r;
- size_t total;
-
- total = n * sz;
- *** 1.5 1991/05/23 14:43:17
- --- memccpy.c 1992/03/06 19:26:31
- ***************
- *** 31,38 ****
- if (size == 0)
- return(NULL);
-
- ! s = src;
- ! d = dst;
- uc = UNSCHAR(ucharstop);
- for (n = size; n > 0; n--)
- if (UNSCHAR(*d++ = *s++) == uc)
- --- 31,38 ----
- if (size == 0)
- return(NULL);
-
- ! s = (const char *) src;
- ! d = (char *)dst;
- uc = UNSCHAR(ucharstop);
- for (n = size; n > 0; n--)
- if (UNSCHAR(*d++ = *s++) == uc)
- *** 1.4 1989/11/12 12:47:43
- --- memchr.c 1992/03/06 19:26:31
- ***************
- *** 26,32 ****
- register size_t n;
- register int uc;
-
- ! scan = s;
- uc = UNSCHAR(ucharwanted);
- for (n = size; n > 0; n--)
- if (UNSCHAR(*scan) == uc)
- --- 26,32 ----
- register size_t n;
- register int uc;
-
- ! scan = (const char *) s;
- uc = UNSCHAR(ucharwanted);
- for (n = size; n > 0; n--)
- if (UNSCHAR(*scan) == uc)
- *** 1.3 1989/03/25 02:56:28
- --- memcmp.c 1992/03/06 19:26:32
- ***************
- *** 17,24 ****
- register const char *scan2;
- register size_t n;
-
- ! scan1 = s1;
- ! scan2 = s2;
- for (n = size; n > 0; n--)
- if (*scan1 == *scan2) {
- scan1++;
- --- 17,24 ----
- register const char *scan2;
- register size_t n;
-
- ! scan1 = (const char *) s1;
- ! scan2 = (const char *) s2;
- for (n = size; n > 0; n--)
- if (*scan1 == *scan2) {
- scan1++;
- *** 1.4 1989/03/25 04:18:12
- --- memset.c 1992/03/06 19:26:32
- ***************
- *** 25,31 ****
- register size_t n;
- register int uc;
-
- ! scan = s;
- uc = UNSCHAR(ucharfill);
- for (n = size; n > 0; n--)
- *scan++ = uc;
- --- 25,31 ----
- register size_t n;
- register int uc;
-
- ! scan = (char *)s;
- uc = UNSCHAR(ucharfill);
- for (n = size; n > 0; n--)
- *scan++ = uc;
- *** 1.15 1992/02/04 17:11:06
- --- mincl 1992/03/06 19:26:32
- ***************
- *** 9,15 ****
- GLIB2 = _adddi3.o _subdi3.o _muldi3.o _divdi3.o _moddi3.o _udivdi3.o \
- _umoddi3.o _negdi2.o _anddi3.o _iordi3.o _xordi3.o _lshrdi3.o \
- _lshldi3.o _ashldi3.o _ashrdi3.o _one_cmpldi2.o _bdiv.o _cmpdi2.o \
- ! _ucmpdi2.o _fixunsdfdi.o _fixdfdi.o _floatdidf.o
-
- GCC= $(GLIB1) $(GLIB2) \
- ldexp.o frexp.o modf.o alloca.o setjmp.o osbind.o\
- --- 9,19 ----
- GLIB2 = _adddi3.o _subdi3.o _muldi3.o _divdi3.o _moddi3.o _udivdi3.o \
- _umoddi3.o _negdi2.o _anddi3.o _iordi3.o _xordi3.o _lshrdi3.o \
- _lshldi3.o _ashldi3.o _ashrdi3.o _one_cmpldi2.o _bdiv.o _cmpdi2.o \
- ! _ucmpdi2.o _fixunsdfdi.o _fixdfdi.o _floatdidf.o \
- ! _lshrsi3.o _lshlsi3.o _ashrsi3.o _ashlsi3.o _eqdf2.o \
- ! _nedf2.o _gtdf2.o _gedf2.o _ltdf2.o _ledf2.o _fixsfsi.o \
- ! _floatsisf.o _eqsf2.o _nesf2.o _gtsf2.o _gesf2.o _ltsf2.o \
- ! _lesf2.o
-
- GCC= $(GLIB1) $(GLIB2) \
- ldexp.o frexp.o modf.o alloca.o setjmp.o osbind.o\
- ***************
- *** 117,122 ****
- --- 121,127 ----
-
- # other dependencies
- bcopy.o : bcopy.s
- + memcpy.o: memcpy.s
- atof.o : flonum.h
-
- #
- *** 1.9 1991/12/26 15:53:59
- --- mkdir.c 1992/03/06 19:26:33
- ***************
- *** 1,5 ****
- --- 1,6 ----
- /* mkdir: make a new directory
- * written by Eric R. Smith and placed in the public domain
- + * modified by Alan Hourihane, to check for directory and return EEXIST.
- */
-
- #include <stdio.h>
- ***************
- *** 6,11 ****
- --- 7,15 ----
- #include <osbind.h>
- #include <support.h>
- #include <unistd.h>
- + #include <errno.h>
- + #include <types.h>
- + #include <stat.h>
- #include "symdir.h"
- #include "lib.h"
-
- ***************
- *** 16,21 ****
- --- 20,26 ----
- int mode;
- {
- int rv, name_munged;
- + struct stat statbuf;
- char path[FILENAME_MAX];
-
- /*
- ***************
- *** 25,30 ****
- --- 30,46 ----
- * in the global variable __link_name[].
- */
- name_munged = (unx2dos(_path, path) == _NM_CHANGE);
- +
- + rv = stat(path, &statbuf); /* Stat directory */
- + if (rv == 0) { /* Does it exist ? */
- + errno = EEXIST; /* Yes, so tell user. */
- + return -1;
- + }
- +
- + if (errno != ENOENT) { /* Return stat error, if other than */
- + return -1; /* File not found. */
- + }
- +
- rv = Dcreate(path);
- if (rv < 0) {
- errno = -rv;
- *** 1.10 1991/04/26 03:42:08
- --- qsort.c 1992/03/06 19:26:37
- ***************
- *** 35,41 ****
- #include <compiler.h>
- #endif
-
- !
- /* the next 4 #defines implement a very fast in-line stack abstraction */
-
- #define MAKE_STACK(S) \
- --- 35,44 ----
- #include <compiler.h>
- #endif
-
- ! /* macros for incrementing/decrementing void pointers */
- ! #define INC(v, size) v = (void *)(((char *)v) + size)
- ! #define DEC(v, size) v = (void *)(((char *)v) - size)
- !
- /* the next 4 #defines implement a very fast in-line stack abstraction */
-
- #define MAKE_STACK(S) \
- ***************
- *** 117,124 ****
- end of the array. This acts like a sentinel, and it speeds
- up the inner loop of insertion sort. */
-
- ! for (run_ptr = (char *)end_ptr - siz; run_ptr >= base;
- ! (char *)run_ptr -= siz)
- if ((*cmp)(run_ptr, tmp_ptr) > 0)
- tmp_ptr = run_ptr;
-
- --- 120,127 ----
- end of the array. This acts like a sentinel, and it speeds
- up the inner loop of insertion sort. */
-
- ! for (run_ptr = (void *)((char *)end_ptr - siz); run_ptr >= base;
- ! DEC(run_ptr, siz))
- if ((*cmp)(run_ptr, tmp_ptr) > 0)
- tmp_ptr = run_ptr;
-
- ***************
- *** 128,143 ****
- /* Typical insertion sort, but we run from the `right-hand-side'
- downto the `left-hand-side.' */
-
- ! for (run_ptr = (char *)end_ptr - siz; run_ptr > base;
- ! (char *)run_ptr -= siz)
- {
- ! tmp_ptr = (char *)run_ptr - siz;
- Move(tmp_ptr, temp, siz);
-
- /* Select the correct location for the new element,
- by sliding everyone down by 1 to make room! */
-
- while ((*cmp)(temp , ((char *)tmp_ptr += siz)) > 0)
- Move(tmp_ptr, ((unsigned char *)tmp_ptr - siz), siz);
-
- Move(temp, (unsigned char *)tmp_ptr - siz, siz);
- --- 131,150 ----
- /* Typical insertion sort, but we run from the `right-hand-side'
- downto the `left-hand-side.' */
-
- ! for (run_ptr = (void *)((char *)end_ptr - siz); run_ptr > base;
- ! DEC(run_ptr, siz))
- {
- ! tmp_ptr = (void *)((char *)run_ptr - siz);
- Move(tmp_ptr, temp, siz);
-
- /* Select the correct location for the new element,
- by sliding everyone down by 1 to make room! */
-
- + #if 0
- while ((*cmp)(temp , ((char *)tmp_ptr += siz)) > 0)
- + #else
- + while (((INC(tmp_ptr, siz)), (*cmp)(temp, tmp_ptr)) > 0)
- + #endif
- Move(tmp_ptr, ((unsigned char *)tmp_ptr - siz), siz);
-
- Move(temp, (unsigned char *)tmp_ptr - siz, siz);
- ***************
- *** 160,166 ****
- int (*cmp)();
- #endif
- {
- ! void *middle = (char *)low + ((((char *)high - (char *)low)/siz) >> 1) * siz;
-
- if ((*cmp)(middle, low) < 0)
- { swap (middle, low, siz); }
- --- 167,173 ----
- int (*cmp)();
- #endif
- {
- ! void *middle = (void *) ((char *)low + ((((char *)high - (char *)low)/siz) >> 1) * siz);
-
- if ((*cmp)(middle, low) < 0)
- { swap (middle, low, siz); }
- ***************
- *** 230,236 ****
- return; /* die */
-
- lo = base;
- ! hi = (char *)lo + (total_elems - 1) * size;
-
- do {
- next: if((char *)hi <= ((char *)lo + Thresh)) /* correct unsigned comapare */
- --- 237,243 ----
- return; /* die */
-
- lo = base;
- ! hi = (void *) ((char *)lo + (total_elems - 1) * size);
-
- do {
- next: if((char *)hi <= ((char *)lo + Thresh)) /* correct unsigned comapare */
- ***************
- *** 245,272 ****
- /* Select the median-of-three here. This allows us to
- skip forward for the LEFT_PTR and RIGHT_PTR. */
- pivot = find_pivot (lo, hi, size, cmp);
- ! left_ptr = (char *)lo + size;
- ! right_ptr = (char *)hi - size;
-
- /* Here's the famous ``collapse the walls'' section of
- quicksort. Gotta like those tight inner loops! */
- do { /* partition loop */ /* see knuth for <= */
- while ((left_ptr < hi) && ((*cmp)(left_ptr, pivot) <= 0))
- ! (char *)left_ptr += size;
-
- while ((right_ptr > lo) && ((*cmp)(pivot, right_ptr) <= 0))
- ! (char *)right_ptr -= size;
-
- if (left_ptr < right_ptr)
- {
- swap (left_ptr, right_ptr, size);
- ! (char *)left_ptr += size;
- ! (char *)right_ptr -= size;
- }
- else if (left_ptr == right_ptr)
- {
- ! (char *)left_ptr +=size;
- ! (char *)right_ptr -= size;
- break;
- }
- } while (left_ptr <= right_ptr);
- --- 252,279 ----
- /* Select the median-of-three here. This allows us to
- skip forward for the LEFT_PTR and RIGHT_PTR. */
- pivot = find_pivot (lo, hi, size, cmp);
- ! left_ptr = (void *)((char *)lo + size);
- ! right_ptr = (void *)((char *)hi - size);
-
- /* Here's the famous ``collapse the walls'' section of
- quicksort. Gotta like those tight inner loops! */
- do { /* partition loop */ /* see knuth for <= */
- while ((left_ptr < hi) && ((*cmp)(left_ptr, pivot) <= 0))
- ! INC(left_ptr, size);
-
- while ((right_ptr > lo) && ((*cmp)(pivot, right_ptr) <= 0))
- ! DEC(right_ptr, size);
-
- if (left_ptr < right_ptr)
- {
- swap (left_ptr, right_ptr, size);
- ! INC(left_ptr, size);
- ! DEC(right_ptr, size);
- }
- else if (left_ptr == right_ptr)
- {
- ! INC(left_ptr, size);
- ! DEC(right_ptr, size);
- break;
- }
- } while (left_ptr <= right_ptr);
- *** 1.5 1991/05/23 14:43:17
- --- random.c 1992/03/06 19:26:37
- ***************
- *** 221,226 ****
- --- 221,233 ----
- * Returns a pointer to the old state.
- */
-
- + #if !__STDC__
- + /* you need an ansi C compatible pre-processor jack! */
- + #else
- + # define STR(s) # s
- + # define XSTR(s) STR(s)
- + #endif
- +
- char *
- initstate( seed, arg_state, n )
-
- ***************
- *** 234,240 ****
- --- 241,251 ----
- else state[ -1 ] = MAX_TYPES*(rptr - state) + rand_type;
- if( n < BREAK_1 ) {
- if( n < BREAK_0 ) {
- + /*
- fprintf( stderr, "initstate: not enough state (%d bytes) with which to do jack; ignored.\n", n );
- + */
- + fputs( "initstate: not enough state (less than " XSTR(BREAK_0)
- + " bytes)\nwith which to do jack; ignored.\n", stderr);
- return NULL;
- }
- rand_type = TYPE_0;
- ***************
- *** 313,319 ****
- --- 324,335 ----
- break;
-
- default:
- + /**
- fprintf( stderr, "setstate: state info has been munged; not changed.\n" );
- + **/
- + fputs("setstate: state info has been munged; not changed.\n",
- + stderr);
- +
- }
- state = &new_state[ 1 ];
- if( rand_type != TYPE_0 ) {
- *** 1.9 1992/02/04 17:11:06
- --- sbrk.c 1992/03/06 19:26:39
- ***************
- *** 32,43 ****
- sp = (void *)slush;
- sz = (sz + 7) & ~((size_t)7L); /* round up request size next octet */
-
- ! if ( sp < (void *)((size_t)_heapbase + sz) )
- {
- return NULL;
- }
- sp = _heapbase;
- ! _heapbase = (void *)((size_t)_heapbase + sz);
- _stksize -= (long)sz;
-
- return( sp );
- --- 32,43 ----
- sp = (void *)slush;
- sz = (sz + 7) & ~((size_t)7L); /* round up request size next octet */
-
- ! if ( sp < (void *)((char *)_heapbase + sz) )
- {
- return NULL;
- }
- sp = _heapbase;
- ! _heapbase = (void *)((char *)_heapbase + sz);
- _stksize -= (long)sz;
-
- return( sp );
- *** 1.5 1991/04/12 18:19:53
- --- sleep.c 1992/03/06 19:26:42
- ***************
- *** 27,33 ****
- *
- */
- void
- ! usleep(unsigned long usec)
- {
- unsigned long stop;
-
- --- 27,34 ----
- *
- */
- void
- ! usleep(usec)
- ! unsigned long usec;
- {
- unsigned long stop;
-
- *** 1.6 1991/06/11 14:56:53
- --- sprintf.c 1992/03/06 19:26:43
- ***************
- *** 2,7 ****
- --- 2,13 ----
- #include <stdio.h>
- #include <limits.h>
-
- + #ifdef __SOZOBON__ /* Electronic brain... */
- + static FILE dummyf =
- + {0L, (unsigned char *)0, (unsigned char *)0,
- + _IOWRT|_IOBIN|_IOSTRING|_IOFBF, 0, LONG_MAX, '\0'};
- + #endif
- +
- __EXTERN int _doprnt __PROTO((FILE *file, const char *fmt, va_list argp));
-
- #ifdef __STDC__
- ***************
- *** 13,22 ****
- #endif
- {
- register int n;
- FILE sf =
- {0L, (unsigned char *)buf, (unsigned char *)buf,
- _IOWRT|_IOBIN|_IOSTRING|_IOFBF, 0, LONG_MAX,'\0'};
- ! va_list argp;
-
- va_start(argp, fmt);
- n = _doprnt(&sf, fmt, argp);
- --- 19,35 ----
- #endif
- {
- register int n;
- + va_list argp;
- + #ifndef __SOZOBON__
- FILE sf =
- {0L, (unsigned char *)buf, (unsigned char *)buf,
- _IOWRT|_IOBIN|_IOSTRING|_IOFBF, 0, LONG_MAX,'\0'};
- ! #else
- ! FILE sf;
- !
- ! sf = dummyf;
- ! sf._ptr = sf._base = (unsigned char *)buf;
- ! #endif
-
- va_start(argp, fmt);
- n = _doprnt(&sf, fmt, argp);
- ***************
- *** 30,39 ****
- --- 43,58 ----
- va_list args;
- {
- register int n;
- + #ifndef __SOZOBON__ /* Same again, please, landlord. */
- FILE sf =
- {0L, (unsigned char *)buf, (unsigned char *)buf,
- _IOWRT|_IOBIN|_IOSTRING|_IOFBF, 0, LONG_MAX,'\0'};
- + #else
- + FILE sf;
-
- + sf = dummyf;
- + sf._ptr = sf._base = (unsigned char *)buf;
- + #endif
- n = _doprnt(&sf, fmt, args);
- *(sf._ptr) = '\0'; /* always tie of the string */
- return(n);
- *** 1.2 1990/04/04 03:11:11
- --- strdup.c 1992/03/06 19:26:46
- ***************
- *** 13,19 ****
- {
- char *dup;
-
- ! dup = malloc(strlen(s)+1);
- if (dup)
- strcpy(dup, s);
- return dup;
- --- 13,19 ----
- {
- char *dup;
-
- ! dup = (char *) malloc(strlen(s)+1);
- if (dup)
- strcpy(dup, s);
- return dup;
- *** 1.13 1992/01/29 20:58:29
- --- system.c 1992/03/06 19:26:51
- ***************
- *** 178,184 ****
- infd = Fopen(path, 0);
- if (infd < __SMALLEST_VALID_HANDLE) {
- perror(infile);
- ! _exit(2);
- }
- oldin = Fdup(0);
- (void)Fforce(0, infd);
- --- 178,184 ----
- infd = Fopen(path, 0);
- if (infd < __SMALLEST_VALID_HANDLE) {
- perror(infile);
- ! return(2);
- }
- oldin = Fdup(0);
- (void)Fforce(0, infd);
- ***************
- *** 196,202 ****
- outfd = Fcreate(path, 0);
- if (outfd < __SMALLEST_VALID_HANDLE) {
- perror(outfile);
- ! _exit(2);
- }
- oldout = Fdup(1);
- (void)Fforce(1, outfd);
- --- 196,202 ----
- outfd = Fcreate(path, 0);
- if (outfd < __SMALLEST_VALID_HANDLE) {
- perror(outfile);
- ! return(2);
- }
- oldout = Fdup(1);
- (void)Fforce(1, outfd);
- *** 1.1 1990/02/27 21:25:34
- --- sysvar.c 1992/03/06 19:26:52
- ***************
- *** 1,7 ****
- #include <support.h>
- #include <osbind.h>
-
- ! long get_sysvar(void *var)
- {
- long ret;
- long save_ssp;
- --- 1,9 ----
- #include <support.h>
- #include <osbind.h>
-
- ! long
- ! get_sysvar(var)
- ! void *var;
- {
- long ret;
- long save_ssp;
- ***************
- *** 15,21 ****
- return ret;
- }
-
- ! void set_sysvar_to_long(void *var, long val)
- {
- long save_ssp;
-
- --- 17,26 ----
- return ret;
- }
-
- ! void
- ! set_sysvar_to_long(var, val)
- ! void *var;
- ! long val;
- {
- long save_ssp;
-
- *** 1.6 1991/04/26 03:42:08
- --- tmpnam.c 1992/03/06 19:26:55
- ***************
- *** 13,19 ****
- {
- char *tmpdir;
-
- ! if (!buf && !(buf = malloc(L_tmpnam)))
- return NULL;
-
- if (!(tmpdir = getenv("TEMP")) && !(tmpdir = getenv("TMPDIR")))
- --- 13,19 ----
- {
- char *tmpdir;
-
- ! if (!buf && !(buf = (char *)malloc(L_tmpnam)))
- return NULL;
-
- if (!(tmpdir = getenv("TEMP")) && !(tmpdir = getenv("TMPDIR")))
-